Release 10.1A: OpenEdge Data Management:
DataServer for Microsoft SQL Server
Join by SQLDB
For queries that include joins issued in
FOREACHandOPENQUERYstatements, the DataServer evaluates the queries and in some cases instructs the MSS data source to perform the joins. A join performed by the data source, called a join by SQLDB, can improve performance; however, you receive the associated query results in an order consistent with the data source, not with the OpenEdge database. To get results that are consistent with the OpenEdge database, turn offJOIN–BY–SQLDB, either with theQUERY–TUNINGphrase at the query level or with the Server Join (-nojoinbysqldb) startup parameter when you compile. If the order of returned records is important to your application, specify a sort order on the query.For each join, the DataServer evaluates whether the MSS data source can perform it and estimates whether doing so improves performance. To determine whether a join by SQLDB is possible, the DataServer assesses whether the following criteria are true:
- All tables in the join are in the same logical OpenEdge database; that is, they are contained in the same DataServer schema.
- Every table, except the innermost one, has a unique record identifier (
ROWIDorRECIDsupport).- The query does not include a
USINGphrase for any of the inner tables. For example, a join by SQLDB will not occur for this query:
- The query does not include a
BYphrase that contains expressions or array fields.- The query does not include a request for an
EXCLUSIVELOCKon any of the tables in the join.- The join does not exceed 10 levels.
To estimate whether performing a join by the data source might improve performance, the DataServer assesses whether these additional criteria are true:
- The join uses an
OFclause or aWHEREclause for each of the inner table loops. For example, the following query requires a field-to-field correspondence between two tables:
- The
WHEREclause includes either an operator or theANDoption. The following example includes the equals (=) operator:
The DataServer also performs a join by SQLDB for the following query:
However, for the following query, the DataServer instructs the client to perform the join because of the
ORoption:
By default, the DataServer instructs an MSS data source to perform a join when possible and when desirable. However, you can control the default behavior by using either the
QUERY–TUNINGNO–JOIN–BY–SQLDBphrase or the Server Join (-nojoinbysqldb) startup parameter. TheQUERY–TUNINGphrase controls the behavior for a single query. The -nojoinbysqldbparameter controls it at the session level. The query-level setting overrides the session-level setting.Table 4–2 describes how these controls interact and affect the behavior.
A join by SQLDB does not occur by default for the following query because the DataServer determines that it does not increase performance:
You receive a warning if you specify
JOIN–BY–SQLDBwhen the MSS data source cannot perform the join and the DataServer performs the join instead. You receive a warning at compile time if you specifyJOIN–BY–SQLDBwhen the data source can perform the join but it is not optimal for it to do so.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |